package com.roam.controller;

import com.roam.DTO.CityOnlyDTO;
import com.roam.DTO.TourPlanDTO;
import com.roam.VO.SelectPagePopularSceneVO;
import com.roam.VO.TourPlanVO;
import com.roam.result.Result;
import com.roam.service.SelectPageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@CrossOrigin
public class SelectPageController {
    @Autowired
    SelectPageService selectPageService;

    @PostMapping("/selectPage/gethot")
    public Result getPopularScenes(@RequestBody CityOnlyDTO cityOnlyDTO) {

        String city=cityOnlyDTO.getCity();
        List<SelectPagePopularSceneVO> popularScenes=selectPageService.getPopularScenes(city);
        return Result.success(popularScenes);

    }

    @PostMapping("/selectPage/getscene")
    public Result getPopularTourPlanVOS(@RequestBody CityOnlyDTO cityOnlyDTO) {

        String city=cityOnlyDTO.getCity();
        List<TourPlanVO> popularScenes=selectPageService.getPopularTourPlanVOS(city);
        return Result.success(popularScenes);

    }

    @PostMapping("/selectPage/getscheme")
    public Result getTourPlan(@RequestBody TourPlanDTO tourPlanDTO) {
        return Result.success(selectPageService.getTourPlan(tourPlanDTO));
    }
}
